package com.heima.apuser.controller;

import com.heima.file.MinIOTemplate;
import com.heima.model.apuser.dto.ApUserRealnameDto;
import com.heima.model.apuser.entity.ApUserRealname;
import com.heima.apuser.service.ApUserRealnameService;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * APP实名认证信息表(ApUserRealname)表控制层
 *
 * @author makejava
 * @since 2022-04-23 17:48:15
 */
@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {
    /**
     * 服务对象
     */
    @Resource
    private ApUserRealnameService apUserRealnameService;

    //上传自媒体用户
    @PostMapping("submit")
    public ResponseResult submit(MultipartFile font_image,
                                 MultipartFile back_image,
                                 MultipartFile hold_image,
                                 MultipartFile live_image,
                                 String name,
                                 String idno) throws IOException {
        return apUserRealnameService.submit(font_image, back_image, hold_image, live_image, name, idno);
    }

    //查询
    @PostMapping("list")
    public ResponseResult list(@RequestBody ApUserRealnameDto dto) {
        return apUserRealnameService.listAll(dto);
    }

    //修改状态通过
    @PostMapping("authPass")
    public ResponseResult updataByauthPass(@RequestBody ApUserRealnameDto dto) {
        return  apUserRealnameService.updataByStatus(dto,9);//9为审核成功
    }

    //修改状态驳回
    @PostMapping("authFail")
    public ResponseResult updataByauthFail(@RequestBody ApUserRealnameDto dto) {
        return  apUserRealnameService.updataByStatus(dto,2);//2为审核失败
    }

}

